<?php
/**
 * MailModel
 * @author tuanna
 *
 */
class MailModel {
	 
	private $sender_name = "Team13 Headspi";
	private $sender_mail = MAIL_USERNAME;
	
	private $receive_name;
	private $receive_mail;
	
	private $subject;
	private $content;
	
	public function MailModel(){

	}
	
	public function send(){
		$config = array(
			'ssl' => MAIL_PROTOCOL,
			'port' => MAIL_PORT,
			'auth' => 'login',
			'username' => MAIL_USERNAME,
			'password' => MAIL_PASSWORD);

		$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
		
		$mail = new Zend_Mail('utf-8');
		
		$mail->setReplyTo($this->sender_mail, $this->sender_name);
		$mail->setFrom($this->sender_mail, $this->sender_name);
		$mail->addTo($this->receive_mail, $this->receive_name);
		
		$mail->setSubject($this->subject);
		$mail->setBodyHtml($this->content, "utf-8", "UTF-8");
		
		try{
			$mail->send($transport);
			
			return true;
		}catch (Exception $e){
			
			return false;
		}
	}
	
	/**
	 * @return the $sender_name
	 */
	public function getSender_name() {
		return $this->sender_name;
	}

	/**
	 * @return the $sender_mail
	 */
	public function getSender_mail() {
		return $this->sender_mail;
	}

	/**
	 * @return the $receive_name
	 */
	public function getReceive_name() {
		return $this->receive_name;
	}

	/**
	 * @return the $receive_mail
	 */
	public function getReceive_mail() {
		return $this->receive_mail;
	}

	/**
	 * @return the $subject
	 */
	public function getSubject() {
		return $this->subject;
	}

	/**
	 * @return the $content
	 */
	public function getContent() {
		return $this->content;
	}

	/**
	 * @param field_type $sender_name
	 */
	public function setSender_name($sender_name) {
		$this->sender_name = $sender_name;
	}

	/**
	 * @param field_type $sender_mail
	 */
	public function setSender_mail($sender_mail) {
		$this->sender_mail = $sender_mail;
	}

	/**
	 * @param field_type $receive_name
	 */
	public function setReceive_name($receive_name) {
		$this->receive_name = $receive_name;
	}

	/**
	 * @param field_type $receive_mail
	 */
	public function setReceive_mail($receive_mail) {
		$this->receive_mail = $receive_mail;
	}

	/**
	 * @param field_type $subject
	 */
	public function setSubject($subject) {
		$this->subject = $subject;
	}

	/**
	 * @param field_type $content
	 */
	public function setContent($content) {
		$this->content = $content;
	}
}
?>